package com.kun.portal.webframe.controller;

import com.kun.portal.webframe.po.FlightPlanePo;
import com.kun.portal.webframe.service.FlightDynamicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.format.datetime.DateFormatter;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;
import java.util.Date;
import java.util.List;

/**
 * Created by Administrator on 2018-07-24.
 */
@RequestMapping({"/api/flightDynamic"})
@Controller
public class FlightDynamicController {
    @Autowired
    private FlightDynamicService flightDynamicService;
    @InitBinder
    public void intDate(WebDataBinder dataBinder){
        dataBinder.addCustomFormatter(new DateFormatter("yyyy-MM-dd"));
    }
    @RequestMapping(
            value = {"/query"},
            method = {RequestMethod.GET},
            produces = {"application/json"}
    )
    @ResponseBody
    public List<FlightPlanePo> query(@RequestParam (required = false) Date expectDate,
                                     @RequestParam (required = false) String importOrExport){
        return flightDynamicService.query(expectDate,importOrExport);
    }


}
